package c.j.a.d.b.j;

import android.app.Notification;
import android.content.Context;
import android.os.Handler;
import android.os.RemoteException;
import c.j.a.d.b.b.g;
import c.j.a.d.b.d.d;
import c.j.a.d.b.d.h0;
import c.j.a.d.b.d.i;
import c.j.a.d.b.d.j;
import c.j.a.d.b.d.n;
import c.j.a.d.b.e.b;
import c.j.a.d.b.e.m;
import c.j.a.d.b.e.p;
import c.j.a.d.b.e.q;
import c.j.a.d.b.e.r;
import c.j.a.d.b.g.a;
import c.j.a.d.b.n.o;
import com.ss.android.socialbase.downloader.downloader.IndependentProcessDownloadService;
import com.ss.android.socialbase.downloader.g.c;
import java.util.List;

/* compiled from: IndependentProcessDownloadHandler */
public class u implements p, q {
    public static final String d = "u";
    public volatile m a;
    public r<IndependentProcessDownloadService> b;
    public p c = new v(false);

    public u() {
        r z = b.z();
        this.b = z;
        z.c(this);
    }

    public void A(boolean z, boolean z2) {
        if (this.a == null) {
            a.f(d, "stopForeground, aidlService is null");
            return;
        }
        a.e(d, "aidlService.stopForeground");
        try {
            this.a.a(z2);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public void B(int i) {
        r rVar = this.b;
        if (rVar != null) {
            rVar.a(i);
        }
    }

    public boolean F(int i) {
        if (this.a == null) {
            return this.c.F(i);
        }
        try {
            return this.a.F(i);
        } catch (RemoteException e) {
            e.printStackTrace();
            return false;
        }
    }

    public boolean G(int i) {
        if (this.a == null) {
            return false;
        }
        try {
            return this.a.B(i);
        } catch (RemoteException e) {
            e.printStackTrace();
            return false;
        }
    }

    public d K(int i) {
        if (this.a != null) {
            try {
                return c.j.a.d.b.n.d.c(this.a.K(i));
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
        return null;
    }

    public void L(int i, boolean z) {
        if (this.a == null) {
            this.c.L(i, z);
            return;
        }
        try {
            this.a.L(i, z);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public int M(int i) {
        if (this.a == null) {
            return c.j.a.d.b.e.d.b().e(i);
        }
        try {
            return this.a.M(i);
        } catch (RemoteException e) {
            e.printStackTrace();
            return -1;
        }
    }

    public j Q(int i) {
        j jVar = null;
        if (this.a != null) {
            try {
                i Q = this.a.Q(i);
                Handler handler = c.j.a.d.b.n.d.a;
                if (Q != null) {
                    jVar = new c.j.a.d.b.n.b(Q);
                }
                return jVar;
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
        return null;
    }

    public void S(int i, boolean z) {
        if (this.a == null) {
            this.c.S(i, z);
            return;
        }
        try {
            this.a.S(i, z);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public boolean T(int i) {
        if (this.a == null) {
            return this.c.T(i);
        }
        try {
            return this.a.T(i);
        } catch (RemoteException e) {
            e.printStackTrace();
            return false;
        }
    }

    public void U(List<String> list) {
        if (this.a == null) {
            this.c.U(list);
            return;
        }
        try {
            this.a.U(list);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public void V(int i, Notification notification) {
        if (this.a == null) {
            a.f(d, "startForeground, aidlService is null");
            return;
        }
        String str = d;
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("aidlService.startForeground, id = ");
        stringBuilder.append(i);
        a.e(str, stringBuilder.toString());
        try {
            this.a.V(i, notification);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public void a(int i) {
        if (this.a != null) {
            try {
                this.a.a(i);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    }

    public void b(c cVar) {
    }

    public boolean b(int i) {
        if (this.a == null) {
            return false;
        }
        try {
            return this.a.b(i);
        } catch (RemoteException e) {
            e.printStackTrace();
            return false;
        }
    }

    public boolean c() {
        boolean z;
        Context context = b.a;
        synchronized (b.class) {
            z = b.L;
        }
        return z;
    }

    public void d(int i) {
        if (this.a != null) {
            try {
                this.a.d(i);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    }

    public boolean e(int i) {
        if (this.a == null) {
            return false;
        }
        try {
            return this.a.e(i);
        } catch (RemoteException e) {
            e.printStackTrace();
            return false;
        }
    }

    public int f(int i) {
        if (this.a == null) {
            return 0;
        }
        try {
            return this.a.f(i);
        } catch (RemoteException e) {
            e.printStackTrace();
            return 0;
        }
    }

    public c g(int i) {
        if (this.a == null) {
            return this.c.g(i);
        }
        try {
            return this.a.g(i);
        } catch (RemoteException e) {
            e.printStackTrace();
            return null;
        }
    }

    public List<com.ss.android.socialbase.downloader.g.b> h(int i) {
        if (this.a == null) {
            return this.c.h(i);
        }
        try {
            return this.a.h(i);
        } catch (RemoteException e) {
            e.printStackTrace();
            return null;
        }
    }

    public void i(int i, List<com.ss.android.socialbase.downloader.g.b> list) {
        if (this.a != null) {
            try {
                this.a.d(i, list);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    }

    public List<c> j(String str) {
        if (this.a == null) {
            return this.c.j(str);
        }
        try {
            return this.a.v(str);
        } catch (RemoteException e) {
            e.printStackTrace();
            return null;
        }
    }

    public void k(int i, int i2, long j) {
        if (this.a == null) {
            this.c.k(i, i2, j);
            return;
        }
        try {
            this.a.k(i, i2, j);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public long l(int i) {
        if (this.a == null) {
            return 0;
        }
        try {
            return this.a.l(i);
        } catch (RemoteException e) {
            e.printStackTrace();
            return 0;
        }
    }

    public void m(int i, int i2, int i3, long j) {
        if (this.a == null) {
            this.c.m(i, i2, i3, j);
            return;
        }
        try {
            this.a.m(i, i2, i3, j);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public void n(int i, int i2, int i3, int i4) {
        if (this.a == null) {
            this.c.n(i, i2, i3, i4);
            return;
        }
        try {
            this.a.n(i, i2, i3, i4);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public void o(int i) {
        if (this.a == null) {
            this.c.o(i);
            return;
        }
        try {
            this.a.o(i);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public void p(int i, boolean z) {
        if (this.a != null) {
            try {
                this.a.o0(i, z);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    }

    public void q(int i, d dVar) {
        if (this.a != null) {
            try {
                this.a.q0(i, c.j.a.d.b.n.d.b(dVar));
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    }

    public void r(int i, int i2, c.j.a.d.b.d.b bVar, g gVar, boolean z, boolean z2) {
        if (this.a != null) {
            try {
                this.a.s0(i, i2, c.j.a.d.b.n.d.d(bVar, gVar != g.SUB), gVar.ordinal(), z, z2);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    }

    public void s(int i, int i2, c.j.a.d.b.d.b bVar, g gVar, boolean z) {
        if (this.a != null) {
            try {
                this.a.d0(i, i2, c.j.a.d.b.n.d.d(bVar, gVar != g.SUB), gVar.ordinal(), z);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    }

    public c t(String str, String str2) {
        return g(b.c(str, str2));
    }

    public void u(n nVar) {
        if (this.a != null) {
            try {
                c.j.a.d.b.d.m mVar;
                m mVar2 = this.a;
                Handler handler = c.j.a.d.b.n.d.a;
                if (nVar == null) {
                    mVar = null;
                } else {
                    mVar = new c.j.a.d.b.n.i(nVar);
                }
                mVar2.A0(mVar);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    }

    public List<c> v(String str) {
        if (this.a != null) {
            try {
                return this.a.j(str);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
        return null;
    }

    public h0 w(int i) {
        h0 h0Var = null;
        if (this.a != null) {
            try {
                c.j.a.d.b.d.u w = this.a.w(i);
                Handler handler = c.j.a.d.b.n.d.a;
                if (w != null) {
                    h0Var = new o(w);
                }
                return h0Var;
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
        return null;
    }

    public void x(c.j.a.d.b.h.c cVar) {
        if (cVar != null) {
            r rVar = this.b;
            if (rVar != null) {
                rVar.a(cVar);
            }
        }
    }

    public void y(int i) {
        if (this.a == null) {
            this.c.y(i);
            return;
        }
        try {
            this.a.y(i);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public void z(int i, int i2, c.j.a.d.b.d.b bVar, g gVar, boolean z) {
        if (this.a != null) {
            try {
                this.a.r0(i, i2, c.j.a.d.b.n.d.d(bVar, gVar != g.SUB), gVar.ordinal(), z);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    }

    public void c(int i) {
        if (this.a != null) {
            try {
                this.a.c(i);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    }

    public void a() {
        if (this.a != null) {
            try {
                this.a.a();
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    }

    public List<c> b(String str) {
        if (this.a == null) {
            return this.c.b(str);
        }
        try {
            return this.a.b(str);
        } catch (RemoteException e) {
            e.printStackTrace();
            return null;
        }
    }

    public void d() {
        r rVar = this.b;
        if (rVar != null) {
            rVar.f();
        }
    }

    public boolean e() {
        if (this.a == null) {
            return this.c.e();
        }
        try {
            return this.a.c();
        } catch (RemoteException e) {
            e.printStackTrace();
            return false;
        }
    }

    public void f(com.ss.android.socialbase.downloader.g.b bVar) {
        if (this.a == null) {
            this.c.f(bVar);
            return;
        }
        try {
            this.a.f(bVar);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public boolean g() {
        return this.a != null;
    }

    public List<c> c(String str) {
        if (this.a == null) {
            return this.c.c(str);
        }
        try {
            return this.a.c(str);
        } catch (RemoteException e) {
            e.printStackTrace();
            return null;
        }
    }

    public void d(int i, List<com.ss.android.socialbase.downloader.g.b> list) {
        if (this.a == null) {
            this.c.d(i, list);
            return;
        }
        try {
            this.a.i(i, list);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public List<c> a(String str) {
        if (this.a == null) {
            return this.c.a(str);
        }
        try {
            return this.a.a(str);
        } catch (RemoteException e) {
            e.printStackTrace();
            return null;
        }
    }

    public boolean b() {
        if (this.a == null) {
            a.f(d, "isServiceForeground, aidlService is null");
            return false;
        }
        a.e(d, "aidlService.isServiceForeground");
        try {
            return this.a.e();
        } catch (RemoteException e) {
            e.printStackTrace();
            return false;
        }
    }

    public void f() {
        if (this.a == null) {
            this.c.f();
            return;
        }
        try {
            this.a.d();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public boolean c(c cVar) {
        if (this.a == null) {
            return this.c.c(cVar);
        }
        try {
            return this.a.b(cVar);
        } catch (RemoteException e) {
            e.printStackTrace();
            return false;
        }
    }

    public int a(String str, String str2) {
        return b.c(str, str2);
    }

    public void a(List<String> list) {
        if (this.a == null) {
            this.c.a((List) list);
            return;
        }
        try {
            this.a.a((List) list);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public boolean a(c cVar) {
        if (this.a == null) {
            return this.c.a(cVar);
        }
        try {
            this.a.a(cVar);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        return false;
    }

    public void a(c.j.a.d.b.h.c cVar) {
        if (cVar != null) {
            r rVar = this.b;
            if (rVar != null) {
                rVar.b(cVar);
            }
        }
    }

    public void a(int i, int i2) {
        if (this.a != null) {
            try {
                this.a.a(i, i2);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    }

    public void a(int i, long j) {
        if (this.a != null) {
            try {
                this.a.a(i, j);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    }
}
